public class TemperatureControlSystem {
    // 定义状态
    private enum State {
        待机状态, 加热状态, 无水状态, 高温状态, 维修状态
    }

    // 当前状态
    private State currentState;

    // 温度和水量
    private int temperature;
    private int waterLevel;

    // 构造函数，初始化状态和参数
    public TemperatureControlSystem() {
        currentState = State.待机状态;
        temperature = 0;
        waterLevel = 0;
    }

    // 改变温度和水量，模拟环境变化
    public void changeEnvironment(int newTemperature, int newWaterLevel) {
        temperature = newTemperature;
        waterLevel = newWaterLevel;
        updateState();
    }

    // 更新状态
    private void updateState() {
        switch (currentState) {
            case 待机状态:
                if (temperature < 20 && waterLevel > 0) {
                    currentState = State.加热状态;
                } else if (temperature < 20 && waterLevel == 0) {
                    currentState = State.无水状态;
                }
                break;
            case 加热状态:
                if (temperature >= 100) {
                    currentState = State.高温状态;
                } else if (waterLevel == 0) {
                    currentState = State.无水状态;
                }
                break;
            case 无水状态:
                if (waterLevel > 0) {
                    currentState = State.加热状态;
                }
                break;
            case 高温状态:
                if (temperature < 100) {
                    currentState = State.待机状态;
                }
                break;
            case 维修状态:
                // 维修完成后，返回待机状态
                currentState = State.待机状态;
                break;
            default:
                break;
        }
    }

    // 模拟水箱烧坏，进入维修状态
    public void simulateBurnout() {
        currentState = State.维修状态;
    }

    // 模拟维修完成
    public void simulateRepair() {
        if (currentState == State.维修状态) {
            currentState = State.待机状态;
        }
    }

    // 打印当前状态
    public void printState() {
        System.out.println("当前状态: " + currentState);
    }

    public static void main(String[] args) {
        TemperatureControlSystem system = new TemperatureControlSystem();

        // 模拟一系列操作
        system.changeEnvironment(18, 50);
        system.printState();

        system.changeEnvironment(100, 50);
        system.printState();

        system.changeEnvironment(18, 0);
        system.printState();

        system.simulateBurnout();
        system.printState();

        system.simulateRepair();
        system.printState();
    }
}